package com.xxx.host;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;

import com.tencentcloudapi.yunjing.v20180228.YunjingClient;

import com.tencentcloudapi.yunjing.v20180228.models.DescribeMachinesRequest;
import com.tencentcloudapi.yunjing.v20180228.models.DescribeMachinesResponse;

public class DescribeMachines//获取区域主机列表
{
    public static void main(String [] args) {
        try{

        	Credential cred = new Credential("AKIDSjkWBdvoXihSytp0C8qJXWKtFLComJCt", "d3GExQeePvBBwSiiTyEFUUJtEKDsHRM1");
            
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("yunjing.tencentcloudapi.com");

            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);            
            
            YunjingClient client = new YunjingClient(cred, "ap-chengdu", clientProfile);
            
            String params = "{\"Limit\":10,\"MachineType\":\"CVM\",\"MachineRegion\":\"ap-chengdu\"}";
            DescribeMachinesRequest req = DescribeMachinesRequest.fromJsonString(params, DescribeMachinesRequest.class);
            
            DescribeMachinesResponse resp = client.DescribeMachines(req);
            
            System.out.println(DescribeMachinesRequest.toJsonString(resp));
        } catch (TencentCloudSDKException e) {
                System.out.println(e.toString());
        }

    }
    
}